package com.flute.haflute.agent.heartbeat;

/**
 * 心跳状态封装类
 */
public class HeartBeatState {

	public enum STATUS {
		UNKOWN, // 心跳信息已发送至DM，但暂无回应，或者在判定故障前无法联系
		ONEWAY, // 收到一次非DM心跳
		ACTIVE
		// 三阶段心跳完成，正常状态
	}

	/** version 版本号 */
	private int version;

	/** activeTime 最近活动时间 */
	private long activeTime;

	/** status 当前状态 */
	private STATUS status;

	public HeartBeatState() {

	}

	public HeartBeatState(STATUS status) {
		this.status = status;
		activeTime = -1;
	}

	public HeartBeatState(STATUS status, long activeTime) {
		this.status = status;
		this.activeTime = activeTime;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int ver) {
		this.version = ver;
	}

	public long getActiveTime() {
		return activeTime;
	}

	public void setActiveTime(long activeTime) {
		this.activeTime = activeTime;
	}

	public STATUS getStatus() {
		return status;
	}

	public void setStatus(STATUS status) {
		this.status = status;
	}

	/*
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "STATUS=" + status + "; activeTime" + activeTime;
	}

}
